#ifndef ATIME_H
#define ATIME_H

#include <QString>
#include <QTime>

class ATime
{
public:
	// hours, minutes, seconds
	ATime();
	ATime(int, int, int);
	ATime(const QTime &);
	
	static ATime fromSeconds(int);
	static ATime fromMinutes(int);
	static ATime fromHours(int);
	
	static ATime fromSecs(int ss)	{ return ATime::fromSeconds(ss); }
	static ATime fromMins(int ms)	{ return ATime::fromMinutes(ms); }
	
/*
	int h() const	{ return hours; }
	int m() const	{ return mins; }
	int s() const	{ return secs; }
*/
	
	int toMinutes() const	{ return (hours * 60) + mins; }
	int toSeconds() const	{ return (hours * 60 * 60) + (mins * 60) + secs; }
	
	int toMins() const	{ return toMinutes(); }
	int toSecs() const	{ return toSeconds(); }
	
	// %1: hour; %2: mins; %3: secs
	QString toString(const QString &) const;

private:
	int hours, mins, secs;
};

ATime operator+(const ATime &, const ATime &);
ATime operator-(const ATime &, const ATime &);

#endif	// ATIME_H
